/**
 * auto generate order number
 * created by mirko
 */
'use strict';
// order type
const TRADE_TYPE = {
    Type: 'ST',
};
// create order
const generateTradeNo = type => new Promise((resolve, reject) => {
    try {
        const randomStr = Math.random().toString().substr(2, 6);
        let trade_no = Math.floor(Date.now() / 1000);
        trade_no = TRADE_TYPE[type] + trade_no + randomStr;
        resolve(trade_no)
    } catch (e) {
        reject(`create order number failed,type:${type},err:${e}`)
    }
})
module.exports = {
    getTradeNo: async () => {
        return generateTradeNo('Type');
    }
};
